<?php
include "RegEx.php";

//$var =  RegEx::httpProtocol("https://www.xzdream.cn/download/面单.pdf");
//var_dump($var);
//‭CB24 9JH
//CB24 9JH
$postcode = "CB24 9JH";
//$code = mb_detect_encoding($postcode, array("ASCII","UTF-8","GB2312","GBK","BIG5"));
//print_r($code);
//die();

var_dump(preg_match('/^[a-zA-Z]{2}\d{2}\s\d[a-zA-Z]{2}$/', $postcode));
die();

$j = 0;
$arr = array('/^[a-zA-Z]\d\s\d[a-zA-Z]{2}$/',
    '/^[a-zA-Z]\d{2}\s\d[a-zA-Z]{2}$/',
    '/^[a-zA-Z]{2}\d\s\d[a-zA-Z]{2}$/',
    '/^[a-zA-Z]{2}\d{2}\s\d[a-zA-Z]{2}$/',
    '/^[a-zA-Z]\d[a-zA-Z]\s\d[a-zA-Z]{2}$/',
    '/^[a-zA-Z]{2}\d[a-zA-Z]\s\d[a-zA-Z]{2}$/',
    '/^GIR\s\d[a-zA-Z]{2}$/');
foreach ($arr as $v) {
    if (preg_match($v, $postcode) === 1) {
        die('dd');
        $j++;
        break;
    }
}
var_dump($j);
die();
